<template>
  <div>
    <div class="top1">
      <span
        class="iconfont icon-arrowRight-copy-copy"
        @click="$router.push('/recommend')"
      ></span>
      限时免费
      <span class="iconfont icon-sousuo"></span>
    </div>

    <div class="boyfree">
      <p>男生限时免费 </p>
      <div class="freebook" v-for="(item,index) in boyfree" :key="index" 
      @click="$router.push({path:'/bookxq',query:{id:item.id,cover:item.cover}})">
        <div class="freeimg" :style="'background-image: url(' + item.cover + ')'"
        v-lazy:background-image="item.cover">
          <span class="iconfont icon-xianmianjiao"></span>
        </div>
        <div class="text3">
          <p class="bookname3">{{item.title}}</p>
          <p class="writer3">{{item.author}}</p>
          <p class="synopsis3">{{item.content}}</p>
          <p class="freetab">免费</p>
        </div>
      </div>
    </div>

    <div class="girlfree">
      <p>女生限时免费 </p>
      <div class="freebook1" v-for="(item,index) in girlfree" :key="index"
      @click="$router.push({path:'/bookxq',query:{id:item.id,cover:item.cover}})">
        <div class="freeimg" :style="'background-image: url(' + item.cover + ')'"
        v-lazy:background-image="item.cover">
          <span class="iconfont icon-xianmianjiao"></span>
        </div>
        <div class="text3">
          <p class="bookname3">{{item.title}}</p>
          <p class="writer3">{{item.author}}</p>
          <p class="synopsis3">{{item.content}}</p>
          <p class="freetab">免费</p>
        </div>
      </div>

      
    </div>

    <!-- 底部组件 -->
    <buttom-nav></buttom-nav>
  </div>
</template>

<script>
import buttomNav from "../components/base/buttomNav.vue";
import {storeFree} from "../api/res"
export default {
  data(){
    return {
      boyfree:[],
      girlfree:[],
    }
  },
  created(){
    //免费
    storeFree().then((data)=>{
      console.log(data.data.list[1].list);
      this.boyfree = data.data.list[0].list;
      this.girlfree = data.data.list[1].list
    })
  },
    components: {
    buttomNav,
  },
};
</script>

<style lang="less">
.top1 {
  width: 100%;
  font-size: 25px;
  font-weight: bold;
  text-align: center;
  line-height: 50px;
  background-color: white;
  border-bottom: 1px solid gainsboro;
  .icon-arrowRight-copy-copy {
    font-size: 25px;
    float: left;
    padding-left: 10px;
  }
  .icon-sousuo {
    font-size: 25px;
    float: right;
    margin-right: 20px;
  }
}
.boyfree {
  border-bottom: 7px solid #f3f3f3;
  background-color: white;
  p {
    font-size: 20px;
    font-weight: bold;
    margin-left: 15px;
    line-height: 40px;
    span {
      display: block;
      width: 60px;
      height: 30px;
      text-align: center;
      border: 1px solid #cccccc;
      font-size: 15px;
      line-height: 32px;
      float: right;
      margin-top: 5px;
      margin-right: 10px;
      border-radius: 20px;
      font-weight: normal;
      color: #707070;
    }
  }
  .freebook {
    background-color: white;
    margin-top: 5px;
    padding-bottom: 10px;
    .freeimg {
      width: 80px;
      height: 100px;
      // border: 1px solid black;
      margin-left: 15px;
      background-size: cover;
      .icon-xianmianjiao {
        color: #e64d2e;
        font-size: 35px;
      }
    }
    .text3 {
      p {
        font-size: 15px;
        font-weight: normal;
      }
      .bookname3 {
        margin-left: 120px;
        font-weight: bold;
        margin-top: -105px;
      }
      .writer3 {
        margin-left: 120px;
        margin-top: -15px;
        font-size: 13px;
        color: #707070;
      }
      .synopsis3 {
        width: 250px;
        margin-left: 120px;
        margin-top: -18px;
        font-size: 13px;
        color: #707070;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
      .freetab {
        margin-left: 120px;
        margin-top: -20px;
        font-size: 13px;
        color: #e64d2e;
      }
    }
  }
}
.girlfree {
  border-bottom: 7px solid #f3f3f3;
  background-color: white;
  padding-bottom: 45px;
//   box-sizing: border-box;
  p {
    font-size: 20px;
    font-weight: bold;
    margin-left: 15px;
    line-height: 40px;
    span {
      display: block;
      width: 60px;
      height: 30px;
      text-align: center;
      border: 1px solid #cccccc;
      font-size: 15px;
      line-height: 32px;
      float: right;
      margin-top: 5px;
      margin-right: 10px;
      border-radius: 20px;
      font-weight: normal;
      color: #707070;
    }
  }
  .freebook1 {
    background-color: white;
    margin-top: 5px;
    padding-bottom: 10px;
    .freeimg {
      width: 80px;
      height: 100px;
      // border: 1px solid black;
      margin-left: 15px;
      background-size: cover;
      .icon-xianmianjiao {
        color: #e64d2e;
        font-size: 35px;
      }
    }
    .text3 {
      p {
        font-size: 15px;
        font-weight: normal;
      }
      .bookname3 {
        margin-left: 120px;
        font-weight: bold;
        margin-top: -105px;
      }
      .writer3 {
        margin-left: 120px;
        margin-top: -15px;
        font-size: 13px;
        color: #707070;
      }
      .synopsis3 {
        width: 250px;
        margin-left: 120px;
        margin-top: -18px;
        font-size: 13px;
        color: #707070;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
      .freetab {
        margin-left: 120px;
        margin-top: -20px;
        font-size: 13px;
        color: #e64d2e;
      }
    }
  }
}
</style>